<template>
    <div>
        <van-nav-bar title="我的报名" left-arrow @click-left="$router.go(-1)" />
        <van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">
            <van-cell v-for="item in matterslist" :key="item.id" @click="guideList(item.commName,item.id)">
                <van-cell class="matters" :title="item.olderCourse" is-link></van-cell>
                <p class="dataName">{{item.createDate}}</p>
            </van-cell>
        </van-list>
    </div>
</template>
<script>
import apiHttp from '../../../../api/index'
export default {
    data() {
        return {
            title: "我的报名",
            loading: false,
            finished: false,
            matterslist:[],
            
            pageSize:10,
            userId:sessionStorage.getItem('userId'),
            total:-1,
            page:0
        }
    },
    mounted(){},
    methods:{
        // 跳转到报名详情
        guideList(name,id){
            this.$router.push({path:"./aplication",query: {id:id,name:name}});
        },
        onLoad(){
            if(this.matterslist.length == this.total){
                this.finished  = true
          		this.loading = false 
            }else{
                this.page++
                this.getMyOlderList()
            }
        },
        // 报名列表
        getMyOlderList(){
            let parmes = {
                page:this.page,
                pageSize:this.pageSize,
                userId:this.userId,
            }
            apiHttp.comIndex.getMyOlderList(parmes,resp=>{
              if(resp.resultCode == '000000'){
                for(let i = 0; i < resp.data.olderList.length; i++){
                    this.matterslist.push(resp.data.olderList[i])
                }
                 this.total = resp.data.total
                  this.loading = false
                }else{
                  Toast(resp.resultMsg)
                }
            })
        }
    }
}
</script>
<style scoped>
@import '../../../../assets/css/community/listIntroduction/guide.css'; 
.van-cell::after {
    content: ' ';
    position: absolute;
    pointer-events: none;
    box-sizing: border-box;
    left: 15px;
    right: 0;
    bottom: 0;
    -webkit-transform: scaleY(.5);
    transform: scaleY(.5);
    border-bottom: 0px solid #ebedf0;
}
.van-cell{
    margin-bottom: 0;
}
.dataName{
    color: #999999;
    font-size: .4rem;
    width: 92%;
    margin: 0.2rem auto;
}
</style>
